package main;

import java.awt.Container;
import java.awt.Rectangle;
import java.awt.TextField;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextArea;

public class InsereAlteraFormula extends JFrame{
	private static final long serialVersionUID = 1L;
	Container cp;
	JButton cancelar, confirmar, somar, subtrair, multiplicar, dividir, abreParentesis, fechaParentesis, factorial, pi, xquadrado, raiz2, percentagem;
	JTextArea display;
	TextField novaFormula, nomebtn;
	JLabel infoNamebtn;
	
	public InsereAlteraFormula() {
		
		setTitle("Inserir/Alterar nova Fórmula");
		setSize(570, 150);
		setLayout(null);
		InicilizaComponents();
		SetPosition();
		addComponents();
		
		setDefaultCloseOperation(EXIT_ON_CLOSE);
	//	setVisible(true);
		
	}

	private void addComponents() {
		// TODO Auto-generated method stub
		cp.add(display);
		cp.add(novaFormula);
		cp.add(nomebtn);
		cp.add(infoNamebtn);
		cp.add(cancelar);
		cp.add(confirmar);
		cp.add(somar);
		cp.add(subtrair);
		cp.add(multiplicar);
		cp.add(dividir);
		cp.add(abreParentesis);
		cp.add(fechaParentesis);
		cp.add(pi);
		cp.add(percentagem);
		cp.add(factorial);
		cp.add(xquadrado);
		cp.add(raiz2);
		
		
	}

	private void SetPosition() {
		display.setBounds(new Rectangle(5, 5, 335, 30));
		cancelar.setBounds(345, 6, 100, 30);
		confirmar.setBounds(450, 6, 100, 30);
		novaFormula.setBounds(new Rectangle(5, 40, 335, 30));
		infoNamebtn.setBounds(340, 40, 100, 30);
		nomebtn.setBounds(450, 40, 100, 30);
		
		somar.setBounds(5, 75, 45, 30);
		subtrair.setBounds(55, 75, 45, 30);
		multiplicar.setBounds(105,  75, 45, 30);
		dividir.setBounds(155, 75, 45, 30);
		abreParentesis.setBounds(205, 75, 45, 30);
		fechaParentesis.setBounds(255, 75, 45, 30);
		factorial.setBounds(305, 75, 45, 30);
		pi.setBounds(355, 75, 45, 30);
		xquadrado.setBounds(405, 75, 45, 30);
		raiz2.setBounds(455, 75, 45, 30);
		percentagem.setBounds(505, 75, 45, 30);
	}

	private void InicilizaComponents() {
		cp=getContentPane();
		display=new JTextArea();
		novaFormula= new TextField("Nova formula");
		nomebtn=new TextField();
		infoNamebtn=new JLabel("Nome do botão: ");
		cancelar=new JButton("Cancelar");
		confirmar=new JButton("Confirmar");
		somar=new JButton("+");
		subtrair=new JButton("-");
		multiplicar=new JButton("*");
		dividir=new JButton("/");
		abreParentesis=new JButton("(");
		fechaParentesis=new JButton(")");
		factorial=new JButton("!");
		pi=new JButton("π");
		xquadrado=new JButton("x²");
		raiz2=new JButton("√");
		percentagem=new JButton("%");
	
		
		
	}
	
}

class DialogBoxSuccessOrNot extends JFrame{
	private static final long serialVersionUID = 1L;
	JLabel label;
	JButton ok;
	Container cp;
	
	public DialogBoxSuccessOrNot() {
		
		label=new JLabel("Sucesso ou nao");
		ok=new JButton("OK");
		
		
		label.setBounds(5, 5, 200, 100);
		ok.setBounds(140, 105, 100, 30);
		cp=getContentPane();
		cp.add(label);
		cp.add(ok);
		setLayout(null);
		setSize(400, 200);
		setVisible(true);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		
	}

}